(function(){window["UC"]=window["UC"]||{};if(window["FCList"]){return}var quoteData=null,repo={listById:new Map,listByXmlId:new Map};window.FCList=function(t,e){this.exemplarId=t["EXEMPLAR_ID"];this.ENTITY_XML_ID=t["ENTITY_XML_ID"];this.template=t["template"];this.scope="web";this.node={main:t["mainNode"],navigation:t["navigationNode"],navigationLoader:t["navigationNodeLoader"],history:t["nodeForOldMessages"],newComments:t["nodeForNewMessages"],formHolder:t["nodeFormHolder"],writersBlock:BX.findChild(t["nodeFormHolder"],{attrs:{id:["record",this.getXmlId(),"writers-block"].join("-")}},true),writers:BX.findChild(t["nodeFormHolder"],{attrs:{id:["record",this.getXmlId(),"writers"].join("-")}},true)};this.ajax=t["ajax"]||null;this.eventNode=this.node.main;this.form=BX.type.isNotEmptyString(t["FORM_ID"])?UCForm.bindFormToEntity(t["FORM_ID"],this):null;this.order=t["order"];this.mid=parseInt(t["mid"]);this.operationIds=[];this.canCheckVisibleComments=true;this.status="ready";this.msg=this.node.navigation?this.node.navigation.innerHTML:"";this.params=e||{};this.rights=t["rights"];this.DATE_TIME_FORMAT=this.params["DATE_TIME_FORMAT"]||null;this.unreadComments=new Map;this.comments=new Map;this.blankComments=new Map;this.blankCommentsForAjax=new Map;this.bindEvents=[];this.registerNewComment=this.registerNewComment.bind(this);this.registerBlankComment=this.registerBlankComment.bind(this);this.privateEvents={onShowActions:function(t,e){fcShowActions(this.node.main,e,t)}.bind(this),OnUCCommentIsInDOM:this.registerNewComment,OnUCBlankCommentIsInDOM:this.registerBlankComment,onExpandComment:fcCommentExpand};this.windowEvents={OnUCCommentWasPulled:function(t,e,i){if(this.getXmlId()!==i["ENTITY_XML_ID"]||this.isOwnOperationId(i["OPERATION_ID"])){return}this.setOperationId(i["OPERATION_ID"]);this.add(t,e,null,null,{live:true});if(this.params["NOTIFY_TAG"]&&this.params["NOTIFY_TEXT"]){window["UC"]["Informer"].check(t,e,this.params["NOTIFY_TAG"],this.params["NOTIFY_TEXT"])}}.bind(this),OnUCommentWasDeleted:function(t,e,i){if(this.getXmlId()!==i["ENTITY_XML_ID"]||this.isOwnOperationId(i["OPERATION_ID"])||!this.getCommentNode(e[1])){return}this.setOperationId(i["OPERATION_ID"]);BX.hide(this.getCommentNode(e[1]));this.comments.delete(e[1])}.bind(this),OnUCommentWasHidden:function(t,e,i){if(this.getXmlId()!==i["ENTITY_XML_ID"]||this.isOwnOperationId(i["OPERATION_ID"])||!this.getCommentNode(e[1])){return}this.setOperationId(i["OPERATION_ID"]);if(this.rights["MODERATE"]==="Y"||this.rights["MODERATE"]==="ALL"||Number(i["USER_ID"])===Number(BX.message("USER_ID"))){var n=BX.findChild(this.getCommentNode(e[1]),{tagName:"DIV",className:"feed-com-block"});if(BX(n)){BX.addClass(n,"feed-com-block-hidden");BX.removeClass(n,"feed-com-block-approved")}}else{BX.hide(this.getCommentNode(e[1]))}}.bind(this),OnUCUserIsWriting:function(e,i){if(i.sent===true){return}if(this.form!==null&&this!==e){return}if(this.form===null&&e!==this.ENTITY_XML_ID){return}i.sent=true;BX.ajax({url:this.url.activity,method:"POST",data:{AJAX_POST:"Y",ENTITY_XML_ID:this.ENTITY_XML_ID,COMMENT_EXEMPLAR_ID:this.exemplarId,MODE:"PUSH&PULL",sessid:BX.bitrix_sessid(),sign:t["sign"],PATH_TO_USER:this.params["PATH_TO_USER"],AVATAR_SIZE:this.params["AVATAR_SIZE"],NAME_TEMPLATE:this.params["NAME_TEMPLATE"],SHOW_LOGIN:this.params["SHOW_LOGIN"]}})}.bind(this),OnUCAfterRecordAdd:function(t,e){if(this.ENTITY_XML_ID===e["messageId"][0]){this.add(e["messageId"],e,true,"simple")}}.bind(this),OnUCFormSubmit:BX.delegate((function(t,e,i,n){if(!i||this.form===null&&t!==this.getXmlId()||this.form!==null&&i.currentEntity!==this){return}n["EXEMPLAR_ID"]=this.exemplarId;n["OPERATION_ID"]=this.getOperationId()}),this),OnUCFormResponse:function(t,e,i){},OnUCFormBeforeShow:function(t){var e=0;if(this.form===null&&t.id[0]===this.getXmlId()){e=t.id[1]}else if(this.form!==null&&t.currentEntity===this){e=t.currentEntity.messageId}else{return}if(e<=0){BX.addClass(this.node.formHolder,"feed-com-add-box-outer-form-shown")}if(BX(this.node.writersBlock)){var i=BX("lhe_buttons_"+t.form.id);if(!i||i.style.display==="none"){i=t.form}if(!this.node.writersBlockPointer){this.node.writersBlockPointer=BX.create("DIV",{style:{display:"none"}});this.node.writersBlock.parentNode.insertBefore(this.node.writersBlockPointer,this.node.writersBlock)}i.appendChild(this.node.writersBlock)}}.bind(this),OnUCFormAfterShow:function(t){if(t.id[0]!==this.getXmlId()){return}var e=BX.findParent(this.node.main,{className:"feed-comments-block"});if(e){BX.addClass(e,"feed-comments-block-editor-shown")}}.bind(this),OnUCFormBeforeHide:function(t){if(this.form===null&&(!t.id||t.id[0]!==this.getXmlId())||this.form!==null&&t.currentEntity!==this){return}var e=BX.findParent(this.node.main,{className:"feed-comments-block"});if(e){BX.removeClass(e,"feed-comments-block-editor-shown")}}.bind(this),OnUCFormAfterHide:function(t){if(this.form===null&&(!t.id||t.id[0]!==this.getXmlId())||this.form!==null&&t.currentEntity!==this){return}BX.removeClass(this.node.formHolder,"feed-com-add-box-outer-form-shown");BX.focus(this.node.formHolder.firstChild);if(this.node.writersBlock&&this.node.writersBlockPointer){this.node.writersBlockPointer.parentNode.insertBefore(this.node.writersBlock,this.node.writersBlockPointer)}}.bind(this),OnUCUsersAreWriting:function(t,e,i,n,s){if(this.getXmlId()===t){this.addWriter(e,i,n,s)}}.bind(this),OnUCCommentRecalculate:function(t){if(this.getXmlId()!==t){return}var e;var i=BX.findChild(this.node.main,{attrs:{"bx-mpl-xml-id":this.ENTITY_XML_ID}},false,true);for(e=0;e<i.length;e++){this.recalcMoreButtonComment(i[e].getAttribute("bx-mpl-entity-id"))}}.bind(this),"BX.BXUrlPreview.onImageLoaded":function(t){if(!BX.type.isPlainObject(t)||!BX.type.isDomNode(t.imageNode)){return}var e=BX.findParent(t.imageNode,{className:"feed-com-block-cover"});if(BX.type.isDomNode(e)){this.recalcMoreButtonComment(e.getAttribute("bx-mpl-entity-id"))}}.bind(this)};if(this.params["NOTIFY_TAG"]&&this.params["NOTIFY_TEXT"]&&window["UC"]["Informer"]){window["UC"]["InformerTags"][this.params["NOTIFY_TAG"]]=window["UC"]["InformerTags"][this.params["NOTIFY_TAG"]]||[]}else{this.params["NOTIFY_TAG"]=null;this.params["NOTIFY_TEXT"]=null}this.initialize();this.checkHash();this.registerComments();BX.onCustomEvent(this.eventNode,"OnUCInitialized",[this.exemplarId]);BX.addCustomEvent(this.eventNode,"OnUCInitialized",this.destroy.bind(this));this.windowEvents["OnUCInitialized"]=this.checkAndDestroy.bind(this);BX.Event.EventEmitter.incrementMaxListeners("OnUCInitialized");BX.addCustomEvent(window,"OnUCInitialized",this.windowEvents["OnUCInitialized"]);BX.ready(function(){setTimeout(function(){BX.onCustomEvent(window,"OnUCHasBeenInitialized",[this.ENTITY_XML_ID,this])}.bind(this),100)}.bind(this));repo.listById.set(this.exemplarId,this);repo.listByXmlId.set(this.getXmlId(),this);return this};window.FCList.prototype={getId:function(){return this.exemplarId},getXmlId:function(){return this.ENTITY_XML_ID},getOperationId:function(){var t=BX.util.getRandomString(20);this.operationIds.push(t);return t},setOperationId:function(t){if(BX.type.isNotEmptyString(t)){this.operationIds.push(t)}},isOwnOperationId:function(t){for(var e=0;e<this.operationIds.length;e++){if(this.operationIds[e]===t){return true}}return false},initialize:function(){this.checkVisibleComments=this.checkVisibleComments.bind(this);this.recalcMoreButtonComment=this.recalcMoreButtonComment.bind(this);this.sendCommentAsBlank=this.sendCommentAsBlank.bind(this);BX.Event.EventEmitter.incrementMaxListeners(scrSpy,"onRead");BX.addCustomEvent(scrSpy,"onRead",this.checkVisibleComments);scrSpy.watchNode(this.node.main);this.initNavigationEvents();this.initPostFormActivity();for(var t=0;t<this.bindEvents.length;t++){BX.bind(this.bindEvents[t][0],this.bindEvents[t][1],this.bindEvents[t][2])}for(t in this.privateEvents){if(this.privateEvents.hasOwnProperty(t)){BX.Event.EventEmitter.incrementMaxListeners(this.eventNode,t);BX.addCustomEvent(this.eventNode,t,this.privateEvents[t])}}if(!BX.type.isBoolean(this.params["USE_LIVE"])||this.params["USE_LIVE"]){for(t in this.windowEvents){if(this.windowEvents.hasOwnProperty(t)){BX.Event.EventEmitter.incrementMaxListeners(t);BX.addCustomEvent(window,t,this.windowEvents[t])}}}if(BX.DD&&!this.node.main.hasAttribute("dropzone")){new BX.DD.dropFiles(this.node.main)}},initNavigationEvents:function(){if(!BX(this.node.navigation)){return}this.bindEvents.unshift([this.node.navigation,"click",function(t){BX.eventCancelBubble(t);t.preventDefault();this.getPagenavigation();return false}.bind(this)])},initPostFormActivity:function(){this.privateEvents["onAct"]=this.act.bind(this);if(this.params["SHOW_POST_FORM"]!=="Y"){return}this.privateEvents["onReply"]=this.reply.bind(this);this.privateEvents["onQuote"]=this.quote.bind(this);this.hideWriter=this.hideWriter.bind(this);this.quoteShow=this.quoteShow.bind(this);this.bindEvents.unshift([this.eventNode,"mouseup",this.privateEvents["onQuote"]]);var t=0;var e=function(e){if(e&&e.currentTarget.contains(e.relatedTarget)){return}if(t>0){clearTimeout(t);t=0}}.bind(this);var i=function(){e();this.reply.apply(this,arguments)}.bind(this);var n=function(){if(t<=0){t=setTimeout(i,200)}}.bind(this);this.bindEvents.unshift([this.node.main,"dragover",n]);this.bindEvents.unshift([this.node.main,"dragenter",n]);this.bindEvents.unshift([this.node.main,"dragleave",e]);this.bindEvents.unshift([this.node.main,"dragexit",e]);this.bindEvents.unshift([this.node.main,"drop",e])},url:{activity:"/bitrix/components/bitrix/main.post.list/activity.php"},destroy:function(){BX.removeCustomEvent(scrSpy,"onRead",this.checkVisibleComments);var t,e;while((e=this.bindEvents.pop())&&e){BX.unbindAll(e[0]);delete e[0];delete e[2]}for(t in this.privateEvents){if(this.privateEvents.hasOwnProperty(t)){BX.removeCustomEvent(this.eventNode,t,this.privateEvents[t]);BX.Event.EventEmitter.decrementMaxListeners(this.eventNode,t);this.privateEvents[t]=null}}this.privateEvents=null;for(t in this.windowEvents){if(this.windowEvents.hasOwnProperty(t)){BX.removeCustomEvent(window,t,this.windowEvents[t]);this.windowEvents[t]=null;BX.Event.EventEmitter.decrementMaxListeners(t)}}this.windowEvents=null;for(t in this.node){if(this.node.hasOwnProperty(t)){this.node[t]=null}}this.unreadComments.clear();this.comments.clear();BX.onCustomEvent(window,"OnUCHasBeenDestroyed",[this.ENTITY_XML_ID,this]);repo.listById.delete(this.exemplarId);if(repo.listByXmlId.get(this.ENTITY_XML_ID)===this){repo.listByXmlId.delete(this.ENTITY_XML_ID)}},checkAndDestroy:function(t){if(this.exemplarId===t||!document.body.contains(this.eventNode)){this.destroy()}},quotePopup:null,quoteCheck:function(){var t="";var e;var i=null;if(window.getSelection){e=window.getSelection();t=e.toString()}else if(document.selection){e=document.selection;t=e.createRange().text}if(t!==""){var n=BX.findParent(e.focusNode,{tagName:"DIV",className:"feed-com-block-cover"},this.node.main);var s=BX.findParent(e.anchorNode,{tagName:"DIV",className:"feed-com-block-cover"},this.node.main);if(n!==s||BX(n)&&!n.hasAttribute("id")){t=""}else if(BX(n)){var o=BX(n.getAttribute("id").replace(/\-cover$/,"-actions-reply"));if(o){i={id:parseInt(o.getAttribute("bx-mpl-author-id")),name:o.getAttribute("bx-mpl-author-name"),gender:o.getAttribute("bx-mpl-author-gender")}}}}if(t===""){if(this.quotePopup){this.quotePopup.hide()}return false}return{text:t,author:i}},quoteShow:function(t,e){e=e||this.quoteCheck()||{};if(!BX.type.isNotEmptyString(e["text"])){return}quoteData=e;if(this.quotePopup==null){this.__quoteShowClick=function(){if(this.form){BX.onCustomEvent(this.form,"onQuote",[this,e["author"],e["text"]])}else{BX.onCustomEvent(window,"OnUCQuote",[this.ENTITY_XML_ID,e["author"],e["text"],true])}}.bind(this);this.__quoteShowHide=function(){quoteData=null;BX.removeCustomEvent(this.quotePopup,"onQuote",this.__quoteShowClick);BX.removeCustomEvent(this.quotePopup,"onHide",this.__quoteShowHide);this.quotePopup=null}.bind(this);this.quotePopup=new MPLQuote;BX.addCustomEvent(this.quotePopup,"onQuote",this.__quoteShowClick);BX.addCustomEvent(this.quotePopup,"onHide",this.__quoteShowHide)}this.quotePopup.show(t)},displayPagenavigation:function(t,e){var i;var n=0;var s;var o=this.node.history;t=t=="hide"?"hide":"show";if(t=="hide"){i=parseInt(this.node.history.offsetHeight);s=i/2e3;s=s<.3?.3:s>.5?.5:s;o.style.overflow="hidden";new BX["easing"]({duration:s*1e3,start:{height:i,opacity:100},finish:{height:n,opacity:0},transition:BX.easing.makeEaseOut(BX.easing.transitions.quart),step:function(t){o.style.maxHeight=t.height+"px";o.style.opacity=t.opacity/100},complete:BX.proxy((function(){o.style.cssText="";o.style.display="none";BX.onCustomEvent(this,"OnUCListWasHidden",[this,[],o])}),this)}).animate()}else{i=parseInt(e||20);o.style.display="block";o.style.overflow="hidden";o.style.maxHeight=i;n=parseInt(this.node.history.offsetHeight);s=(n-i)/(2e3-i);s=s<.3?.3:s>.8?.8:s;new BX["easing"]({duration:s*1e3,start:{height:i,opacity:i>0?100:0},finish:{height:n,opacity:100},transition:BX.easing.makeEaseOut(BX.easing.transitions.quart),step:function(t){o.style.maxHeight=t.height+"px";o.style.opacity=t.opacity/100},complete:BX.proxy((function(){o.style.cssText="";o.style.maxHeight="none";BX.onCustomEvent(this,"OnUCListWasShown",[this,[],o])}),this)}).animate()}},getPagenavigation:function(){if(this.status=="done"){if(this.node.navigation.getAttribute("bx-visibility-status")=="visible"){this.displayPagenavigation("hide");BX.adjust(this.node.navigation,{attrs:{"bx-visibility-status":"none"},html:this.msg})}else{this.displayPagenavigation("show");BX.adjust(this.node.navigation,{attrs:{"bx-visibility-status":"visible"},html:BX.message("BLOG_C_HIDE")})}}else if(this.status=="ready"){this.sendPagenavigation()}return false},sendPagenavigation:function(){this.status="busy";BX.addClass(this.node.navigation,"feed-com-all-hover");var t={AJAX_POST:"Y",ENTITY_XML_ID:this.ENTITY_XML_ID,EXEMPLAR_ID:this.exemplarId,MODE:"LIST",FILTER:this.order=="ASC"?{">ID":this.mid}:{"<ID":this.mid},sessid:BX.bitrix_sessid()},e=BX.util.htmlspecialcharsback(this.node.navigation.getAttribute("href"));e=e.indexOf("#")!==-1?e.substr(0,e.indexOf("#")):e;var i={url:e,data:t};BX.onCustomEvent(this,"OnUCListHasToBeEnlarged",[this,i]);e=i.url;t=i.data;t.scope=this.scope;var n=this.buildPagenavigation.bind(this);var s=this.completePagenavigation.bind(this);if(this.ajax["navigateComment"]===true){e=e.indexOf("?")>=0?e.substr(e.indexOf("?")+1):"";e.split("&").forEach((function(e){var i=e.split("=");t[i[0]]=i[1]}));BX.ajax.runComponentAction(this.ajax.componentName,"navigateComment",{mode:"class",data:t,signedParameters:this.ajax.params}).then(n,s)}else{BX.adjust(this.node.navigationLoader,{style:{display:"flex"}});BX.ajax({url:e+(e.indexOf("?")!==-1?"&":"?")+BX.ajax.prepareData(t),method:"GET",dataType:"json",data:"",onsuccess:n,onfailure:s})}},buildPagenavigation:function(t){if(t["status"]!=="success"){return this.completePagenavigation()}this.status="ready";this.wait("hide");BX.adjust(this.node.navigationLoader,{style:{display:"none"}});BX.removeClass(this.node.navigation,"feed-com-all-hover");var e=BX.processHTML(t["messageList"],false);var i=this.node.history.offsetHeight;var n=BX.create("DIV",{html:e.HTML});if(this.order==="ASC"||!this.node.history.firstChild){this.node.history.appendChild(n)}else{this.node.history.insertBefore(n,this.node.history.firstChild)}BX.onCustomEvent(window,"OnUCFeedChanged",[[this.ENTITY_XML_ID,this.mid]]);this.displayPagenavigation("show",i);if(BX.type.isNotEmptyString(t["navigation"])){var s=BX.create("DIV",{html:t["navigation"]}).firstChild;BX.adjust(this.node.navigation,{attrs:{href:s.getAttribute("href"),"bx-mpl-comments-count":s.getAttribute("bx-mpl-comments-count")},html:s.innerHTML})}else{BX.adjust(this.node.navigation,{attrs:{href:"#","bx-visibility-status":"visible","bx-mpl-comments-count":0},html:BX.message("BLOG_C_HIDE"),events:{click:function(t){BX.eventCancelBubble(t);t.preventDefault();return false}}});this.status="done"}var o=0;var a=function(){o++;if(o>100){return}if(n.childNodes.length<=0){setTimeout(a,500);return}BX.ajax.processScripts(e.SCRIPT);BX.onCustomEvent(this,"OnUCListWasBuilt",[this,t,n])}.bind(this);setTimeout(a,500)},completePagenavigation:function(){this.status="done";BX.removeClass(this.node.navigation,"feed-com-all-hover");this.wait("hide");BX.adjust(this.node.navigationLoader,{style:{display:"none"}})},getCommentsCount:function(){var t=0;if(BX(this.node.navigation)){t=Number(this.node.navigation.getAttribute("bx-mpl-comments-count"))}return this.comments.size+t},wait:function(t){t=t==="show"?"show":"hide";return t},quote:function(t,e){if(t.hasOwnProperty("UCDone")){return}t["UCDone"]=true;setTimeout(this.quoteShow,50,t,e)},reply:function(t){var e={id:undefined,name:undefined};if(BX.type.isElementNode(t)){e.id=t.getAttribute("bx-mpl-author-id");e.name=t.getAttribute("bx-mpl-author-name")}else if(BX.type.isPlainObject(t)){e.id=t.id;e.name=t.name}if(this.form){BX.onCustomEvent(this.form,"onReply",[this,e])}else{var i={caught:false};BX.onCustomEvent(window,"OnUCReply",[this.ENTITY_XML_ID,e.id,e.name,true,i])}},getPlaceholder:function(t){if(!this.node["placeholderFor"+t]||!document.body.contains(this.node["placeholderFor"+t])){this.node["placeholderFor"+t]=BX.findChild(this.node.main,{attrs:{id:["record",this.getXmlId(),t,"placeholder"].join("-")}},true)}return this.node["placeholderFor"+t]},addWriter:function(t,e,i,n){if(!this.node.writersBlock||!this.node.writers){return}t=t>0?t:0;if(t<=0){return}var s=["writer",this.exemplarId,t].join("-");var o=BX(s);var a=setTimeout(this.hideWriter,n>0?n:40500,t);if(o){clearTimeout(o.getAttribute("bx-check-timeout"))}else{o=BX.create("DIV",{attrs:{id:s,className:"feed-com-avatar ui-icon ui-icon-common-user ",title:e},children:[i&&i.length>0?BX.create("I",{style:{background:"url('"+i+"')",backgroundSize:"cover"}}):null]});this.node.writers.appendChild(o)}o.setAttribute("bx-check-timeout",a+"");BX.show(this.node.writersBlock);if(this.objAnswering&&this.objAnswering.name!=="show"){this.objAnswering.stop()}if(!this.objAnswering||this.objAnswering.name!=="show"){this.node.writersBlock.style.display="inline-block";this.objAnswering=new BX["easing"]({duration:500,start:{opacity:0},finish:{opacity:100},transition:BX.easing.makeEaseOut(BX.easing.transitions.quart),step:function(t){this.node.writersBlock.style.opacity=t.opacity/100}.bind(this)});this.objAnswering.name="show";this.objAnswering.animate()}},hideWriter:function(t){if(!this.node.writers||!this.node.writersBlock){return}var e=["writer",this.exemplarId,t].join("-");var i=BX(e);if(this.node.writers.childNodes.length>1){new BX["easing"]({duration:500,start:{opacity:100},finish:{opacity:0},transition:BX["easing"].makeEaseOut(BX["easing"].transitions.quart),step:function(t){if(i)i.style.opacity=t.opacity/100},complete:function(){if(i&&i.parentNode){i.parentNode.removeChild(i)}}.bind(this)}).animate()}else{if(this.objAnswering&&this.objAnswering.name!=="hide"){this.objAnswering.stop()}if(!this.objAnswering||this.objAnswering.name!=="hide"){this.objAnswering=new BX["easing"]({duration:500,start:{opacity:100},finish:{opacity:0},transition:BX["easing"].makeEaseOut(BX.easing.transitions.quart),step:function(t){this.node.writersBlock.style.opacity=t.opacity/100}.bind(this),complete:function(){this.node.writersBlock.style.display="none";if(i&&i.parentNode){i.parentNode.removeChild(i)}}.bind(this)});this.objAnswering.name="hide";this.objAnswering.animate()}}},getCommentNode:function(t){if(!this.node[t]||!document.body.contains(this.node[t])){this.node[t]=BX.findChild(this.node.main,{attrs:{id:["record",this.getXmlId(),t,"cover"].join("-")}},true)}return this.node[t]},add:function(t,e,i,n,s){if(!t||!t[1]||!BX.type.isPlainObject(e)){return false}var o=e["AUTHOR"]||(e["messageFields"]?e["messageFields"]["AUTHOR"]:null);if(o){this.hideWriter(o["ID"])}var a=this.getCommentNode(t[1]);if(!a&&t[1]<this.mid){return false}var r=t.join("-");var d=e["message"]||window.fcParseTemplate({messageFields:e["messageFields"]},{EXEMPLAR_ID:this.exemplarId,RIGHTS:this.rights,DATE_TIME_FORMAT:this.DATE_TIME_FORMAT,VIEW_URL:this.params.VIEW_URL,EDIT_URL:this.params.EDIT_URL,MODERATE_URL:this.params.MODERATE_URL,DELETE_URL:this.params.DELETE_URL,AUTHOR_URL:this.params.AUTHOR_URL,AUTHOR_URL_PARAMS:this.params.AUTHOR_URL_PARAMS,NAME_TEMPLATE:this.params.NAME_TEMPLATE,SHOW_LOGIN:this.params.SHOW_LOGIN,CLASSNAME:BX.type.isPlainObject(s)&&s.live?"feed-com-block-live":""},this.getTemplate());var l=BX.processHTML(d,false);var h;var m=this.node.newComments;var c=["MODERATE","EDIT","DELETE"];var u=false;var p=0;for(var E in c){if(c.hasOwnProperty(E)&&this.rights[c[E]]==="OWNLAST"){u=true;break}}if(u){h=m.lastChild&&BX.hasClass(m.lastChild,"feed-com-block-cover")?[m.lastChild]:[];var f;var T;if(this.addCheckPreviousNodes!==true){h=BX.findChildren(this.node.main,{tagName:"DIV",className:"feed-com-block-cover"},false)||[];h.concat(BX.findChildren(m,{tagName:"DIV",className:"feed-com-block-cover"},false)||[]);this.addCheckPreviousNodes=true}while((f=h.pop())&&f){T=BX.findChild(f,{attrs:{id:f.id.replace("-cover","-actions")}},true);if(T){if(this.rights["EDIT"]==="OWNLAST"){T.setAttribute("bx-mpl-edit-show","N")}if(this.rights["MODERATE"]==="OWNLAST"){T.setAttribute("bx-mpl-moderate-show","N")}if(this.rights["DELETE"]==="OWNLAST"){T.setAttribute("bx-mpl-delete-show","N")}}}}var X=false;if(!a){a=BX.create("DIV",{attrs:{id:"record-"+r+"-cover",className:"feed-com-block-cover","bx-mpl-xml-id":this.getXmlId(),"bx-mpl-entity-id":t[1],"bx-mpl-read-status":Number(o["ID"])!==Number(BX.message("USER_ID"))?"new":"old","bx-mpl-block":"main"},style:{opacity:0,height:0,overflow:"hidden",marginBottom:0},html:l.HTML});m.appendChild(a);X=true}else{var B=BX.create("DIV",{attrs:{id:"record-"+r+"-cover",className:"feed-com-block-cover"},style:{display:"none"},html:l.HTML});var I=a;var A=BX.findChild(I,{tag:"div",className:"feed-com-text-inner"},true);var g=A&&A.classList.contains("feed-com-text-inner-expanded");if(g){A=BX.findChild(B,{tag:"div",className:"feed-com-text-inner"},true);if(A){A.classList.add("feed-com-text-inner-expanded")}}a.parentNode.insertBefore(B,a);a.removeAttribute("id");p=a.scrollHeight;BX.hide(a);BX.show(B);a=B;this.node[t[1]]=a;setTimeout((function(){BX.remove(I)}),1e3)}if(n!=="simple"&&BX.Type.isUndefined(window.BXMobileApp)&&!(window.top===window&&BX.getClass("BX.SidePanel.Instance")&&BX.SidePanel.Instance.isOpen())&&!(BX.type.isNotEmptyObject(BXRL)&&BX.type.isNotEmptyObject(BXRL.render)&&BX.type.isDomNode(BXRL.render.reactionsPopup)&&!BXRL.render.reactionsPopup.classList.contains("feed-post-emoji-popup-invisible"))){var v=BX.pos(a);var _=BX.GetWindowScrollPos();var b=BX.GetWindowInnerSize();new BX["easing"]({duration:1e3,start:{opacity:X?0:100,height:p},finish:{opacity:100,height:a.scrollHeight+10},transition:BX.easing.makeEaseOut(BX.easing.transitions.quart),step:function(t){a.style.height=t.height+"px";a.style.opacity=t.opacity/100;if(_.scrollTop>0&&v.top<_.scrollTop+b.innerHeight){window.scrollTo(0,_.scrollTop+t.height)}},complete:function(){a.style.cssText="";BX.onCustomEvent(this,"OnUCRecordWasShown",[this.ENTITY_XML_ID,r,a])}.bind(this)}).animate()}else{new BX["easing"]({duration:500,start:{opacity:X?0:100,height:p},finish:{opacity:100,height:a.scrollHeight+10},transition:BX.easing.makeEaseOut(BX.easing.transitions.cubic),step:function(t){a.style.height=t.height+"px";a.style.opacity=t.opacity/100},complete:BX.proxy((function(){a.style.cssText="";BX.onCustomEvent(this,"OnUCRecordWasShown",[this.ENTITY_XML_ID,r,a])}),this)}).animate()}var C=0,w=function(){if(100<++C){return}if(this.getCommentNode(t[1]).childNodes.length>0){BX.ajax.processScripts(l.SCRIPT);if(this.params["BIND_VIEWER"]==="Y"&&BX["viewElementBind"]){BX.viewElementBind(this.getCommentNode(t[1]),{},(function(t){return BX.type.isElementNode(t)&&(t.getAttribute("data-bx-viewer")||t.getAttribute("data-bx-image"))}))}}else{setTimeout(w,500)}BX.onCustomEvent(window,"OnUCRecordHasDrawn",[this.ENTITY_XML_ID,t,e["messageFields"]||e]);BX.onCustomEvent(window,"OnUCCommentWasAdded",[this.ENTITY_XML_ID,t,e["messageFields"]||e]);BX.onCustomEvent(window,"OnUCFeedChanged",[t])}.bind(this);setTimeout(w,500);return true},act:function(url,id,act){if(this.ajax["processComment"]!==true&&BX.type.isNotEmptyString(url)&&url.substr(0,1)!=="/"){try{eval(url);return false}catch(t){}if(BX.type.isFunction(url)){url(this,id,act);return false}}this.showWait(id);id=parseInt(id);var data={sessid:BX.bitrix_sessid(),MODE:"RECORD",NOREDIRECT:"Y",AJAX_POST:"Y",FILTER:{ID:id},ACTION:act==="EDIT"?"GET":act,ID:id,ENTITY_XML_ID:this.ENTITY_XML_ID,OPERATION_ID:this.getOperationId(),EXEMPLAR_ID:this.exemplarId,scope:this.scope};url=url.indexOf("#")!==-1?url.substr(0,url.indexOf("#")):url;var onsuccess=function(t){this.closeWait(id);if(t["status"]==="error"){this.showError(id,t["message"]||"Unknown error.");return}var e=this.getCommentNode(id);if(e){if(act==="DELETE"){BX.hide(e);this.comments.delete(id.toString());BX.onCustomEvent(window,"OnUCommentWasDeleted",[this.ENTITY_XML_ID,[this.ENTITY_XML_ID,id],t])}else if(act!=="EDIT"&&!!t["message"]){var i=BX.processHTML(t["message"],false);e.innerHTML=i.HTML;var n=0,s=function(){n++;if(n<100){if(e.childNodes.length>0)BX.ajax.processScripts(i.SCRIPT);else BX.defer(s)()}};BX.defer(s)();t["okMessage"]=""}}if(this.form!==null){BX.onCustomEvent(this.form,"onEdit",[this,id,t,act])}else{BX.onCustomEvent(window,"OnUCAfterRecordEdit",[this.ENTITY_XML_ID,id,t,act])}BX.onCustomEvent(window,"OnUCFeedChanged",[id])}.bind(this);var onfailure=function(t){this.closeWait(id);var e=t;if(BX.type.isNotEmptyObject(t)){if(BX.type.isArray(t.errors)&&BX.type.isNotEmptyString(t.errors[0].message)){e=t.errors[0].message}else if(BX.type.isNotEmptyObject(t.data)&&BX.type.isNotEmptyString(t.data.message)){e=t.data.message}}this.showError(id,e)}.bind(this);if(this.ajax["processComment"]===true){BX.ajax.runComponentAction(this.ajax.componentName,"processComment",{mode:"class",data:data,signedParameters:this.ajax.params}).then(onsuccess,onfailure)}else{BX.ajax({method:"GET",url:url+(url.indexOf("?")!==-1?"&":"?")+BX.ajax.prepareData(data),data:"",dataType:"json",onsuccess:onsuccess,onfailure:onfailure})}},showError:function(t,e){if(this.errorWindow){this.errorWindow.close()}this.errorWindow=new BX.PopupWindow("bx-comments-error",null,{autoHide:false,zIndex:200,overlay:{opacity:50,backgroundColor:"#000000"},buttons:[new BX.PopupWindowButton({text:BX.message("MPL_CLOSE"),events:{click:BX.delegate((function(){if(this.errorWindow)this.errorWindow.close()}),this)}})],closeByEsc:true,titleBar:{content:BX.create("span",{props:{className:"popup-window-titlebar-text feed-error-title"},html:'<div class="feed-error-icon"></div>'+BX.message("MPL_ERROR_OCCURRED")})},closeIcon:true,contentColor:"white",content:'<div class="feed-error-block">'+e+"</div>"});this.errorWindow.show()},checkHash:function(){if(repo["hashHasBeenFound"]===true){return}var t=/%23com(\d+)/gi.exec(location.href);var e=parseInt(location.hash&&location.hash.indexOf("#com")>=0?location.hash.replace("#com",""):t?t[1]:0);if(e>0){var i=BX.findChild(this.node.main,{attrs:{id:"record-"+[this.ENTITY_XML_ID,e].join("-")+"-cover"}},true,false);if(i){var n=BX.findParent(i,{attrs:{"data-bx-role":"collapsed-block"}},this.node.main);if(n){var s=n.querySelector("input[type=checkbox]");if(!s.checked){s.click(true)}}repo["hashHasBeenFound"]=true;var o=BX.pos(i);window.scrollTo(0,o["top"]);var a=BX.findChild(i,{className:"feed-com-main-content"},true,false);BX.removeClass(a,"feed-com-block-pointer-to-new feed-com-block-new");BX.addClass(a,"feed-com-block-pointer")}}},registerComments:function(){var t;var e=BX.findChild(this.node.main,{tag:"DIV",attrs:{"bx-mpl-block":"main","bx-mpl-xml-id":this.ENTITY_XML_ID}},true,true);for(t=0;t<e.length;t++){if(e[t].getAttribute("bx-mpl-blank-status")==="blank"){this.blankComments.set(e[t].getAttribute("bx-mpl-entity-id"),e[t]);scrSpy.set([this.getXmlId(),e[t].getAttribute("bx-mpl-entity-id")].join("-"))}else{if(e[t].getAttribute("bx-mpl-read-status")==="new"){this.unreadComments.set(e[t].getAttribute("bx-mpl-entity-id"),e[t]);scrSpy.set([this.getXmlId(),e[t].getAttribute("bx-mpl-entity-id")].join("-"))}this.recalcMoreButtonComment(e[t].getAttribute("bx-mpl-entity-id"));this.comments.set(e[t].getAttribute("bx-mpl-entity-id"),[])}}},registerBlankComment:function(t,e){if(e!==true){setTimeout(this.registerBlankComment,1e3,t,true);return}var i=this.getCommentNode(t);if(!i||this.comments.has(t)||this.blankComments.has(t)){return}this.blankComments.set(t,i);scrSpy.set([this.getXmlId(),t].join("-"))},registerNewComment:function(t,e){if(e!==true){setTimeout(this.registerNewComment,1e3,t,true);return}var i=this.getCommentNode(t);if(!i||this.comments.has(t)){return}this.comments.set(t,[]);if(i.getAttribute("bx-mpl-read-status")==="new"){scrSpy.set([this.getXmlId(),t].join("-"),i);this.unreadComments.set(t,i)}this.recalcMoreButtonComment(t)},recalcMoreButtonComment:function(t){var e=this.getCommentNode(t);if(!BX(e)){return}var i=e.bodyBlock||BX.findChild(e,{attrs:{"bx-mpl-block":"body"}},true);if(!i){return}e.bodyBlock=i;var n=e.textBlock||BX.findChild(i,{attrs:{"bx-mpl-block":"text"}},true);if(!n){return}e.textBlock=n;var s=e.moreButtonBlock||BX.findChild(e,{attrs:{"bx-mpl-block":"more-button"}},true);e.moreButtonBlock=s;var o=BX.pos(i);var a=BX.pos(n);if(o.height>=a.height){s.style.display="none"}else if(s.style.display!=="block"){s.style.display="block"}var r=null;var d=BX.findChildren(i,{attr:{"data-bx-onload":"Y"}},true);var l=function(){this.recalcMoreButtonComment(t)}.bind(this);if(BX.type.isArray(d)){for(r=0;r<d.length;r++){d[r].addEventListener("load",l);d[r].setAttribute("data-bx-onload","N")}}var h=i.querySelectorAll("video");for(r=0;r<h.length;r++){h[r].addEventListener("loadedmetadata",l)}if(!e.hasOwnProperty("__boundOnForumSpoilerToggle")){e.__boundOnForumSpoilerToggle=true;BX.addCustomEvent(e,"onForumSpoilerToggle",l)}},checkVisibleComments:function(t){if(!this.canCheckVisibleComments){return}var e=this.getVisibleCommentIds(this.unreadComments,t);var i;while(i=e.shift()){this.markCommentAsRead(i)}window.fclistdebug=true;e=this.getVisibleCommentIds(this.blankComments,t);while(i=e.shift()){this.markCommentAsBlank(i)}},getVisibleCommentIds:function(t,e){var i=[];if(t.size<=0){return i}var n=BX.pos(this.node.main);if(n.top>e.bottom||n.bottom<e.top||n.top===0&&n.bottom===0){return i}var s=t.keys();var o=s.next();var a;while(o.done!==true){a=t.get(o.value);if(a.offsetWidth||a.offsetHeight||a.getClientRects().length){n=a.pos||BX.pos(a);a.pos=n;if(e.top<=n.top&&n.top<=e.bottom&&a.offsetParent!==null){i.push(o.value)}}o=s.next()}return i},markCommentAsRead:function(t){if(!this.unreadComments.has(t)){return}var e=this.unreadComments.get(t);e.setAttribute("bx-mpl-read-status","old");this.unreadComments.delete(t);scrSpy.unset([this.getXmlId(),t].join("-"));if(this.node.newComments.contains(e)){this.sendCommentAsRead(t)}BX.removeClass(e,"comment-new-answer");if(this.__checkNodeCorner!==true){this.__checkNodeCorner=true;var i=BX.findChild(this.node.main,{className:"feed-com-corner"});if(i){BX.addClass(i,"feed-post-block-corner-fade")}}var n=BX.findChild(e,{className:"feed-com-main-content"},true,false);if(n){BX.removeClass(n,"feed-com-block-pointer-to-new feed-com-block-new");BX.addClass(n,"feed-com-block-read")}var s=BX.findChild(e,{className:"feed-com-block"},true);BX.onCustomEvent(window,"OnUCCommentWasRead",[this.getXmlId(),[this.getXmlId(),t],{live:s&&s.classList.contains("feed-com-block-live"),new:!n||!n.classList.contains("feed-com-block-old")}])},sendCommentAsRead:function(t){if(this.ajax["readComment"]!==true){return}if(!this.sendCommentAsReadData){this.sendCommentAsReadData={mid:0,timeoutId:0,func:function(){BX.unbind(window,"beforeunload",this.sendCommentAsReadData.func);BX.removeCustomEvent(window,"onHidePageBefore",this.sendCommentAsReadData.func);this.sendCommentAsReadData.timeoutId=0;BX.ajax.runComponentAction(this.ajax.componentName,"readComment",{mode:"class",data:{ID:this.sendCommentAsReadData.mid},signedParameters:this.ajax.params})}.bind(this)}}if(this.sendCommentAsReadData.mid>t){return}this.sendCommentAsReadData.mid=t;if(this.sendCommentAsReadData.timeoutId<=0){BX.bind(window,"beforeunload",this.sendCommentAsReadData.func);BX.addCustomEvent(window,"onHidePageBefore",this.sendCommentAsReadData.func);this.sendCommentAsReadData.timeoutId=setTimeout(this.sendCommentAsReadData.func,6e3)}},markCommentAsBlank:function(t){if(!this.blankComments.has(t)){return}var e=this.blankComments.get(t);var i=e.parentNode;if(i&&!i.bxwaiter){fcShowWait(i)}this.blankComments.delete(t);scrSpy.unset([this.getXmlId(),t].join("-"));this.blankCommentsForAjax.set(t,e);setTimeout(this.sendCommentAsBlank,1e3)},sendCommentAsBlank:function(){if(this.ajax["getComment"]!==true||this.blankCommentsForAjax.size<=0){return}var t=Array.from(this.blankCommentsForAjax.keys());var e=new Map(this.blankCommentsForAjax);this.blankCommentsForAjax.clear();var i=function(t){e.forEach(function(e,i){fcCloseWait(e.parentNode);var n=t["messageList"][i];if(!n){e.parentNode.removeChild(e)}else{var s=BX.processHTML(n["message"],false);e.innerHTML=s.HTML;var o=function(t){if(e.childNodes.length>0){BX.ajax.processScripts(s.SCRIPT)}else if(t<100){setTimeout(o,500,t+1)}};o(0)}}.bind(this))}.bind(this);BX.ajax.runComponentAction(this.ajax.componentName,"getComment",{mode:"class",data:{sessid:BX.bitrix_sessid(),MODE:"RECORDS",NOREDIRECT:"Y",AJAX_POST:"Y",FILTER:{ID:t},ACTION:"GET",ID:t,ENTITY_XML_ID:this.ENTITY_XML_ID,OPERATION_ID:this.getOperationId(),EXEMPLAR_ID:this.exemplarId,scope:this.scope},signedParameters:this.ajax.params}).then(i,i)},getTemplate:function(){return this.template},showWait:function(t){fcShowWait(BX("record-"+this.ENTITY_XML_ID+"-"+t+"-actions"))},closeWait:function(t){fcCloseWait(BX("record-"+this.ENTITY_XML_ID+"-"+t+"-actions")||null)}};window.FCList.getQuoteData=function(){return quoteData};window.FCList.getInstance=function(t,e){if(!repo.listByXmlId.has(t["ENTITY_XML_ID"])&&e!==undefined){new window.FCList(t,e)}return repo.listByXmlId.get(t["ENTITY_XML_ID"])};var lastWaitElement=null;var fcShowWait=function(t){if(t&&!BX.type.isElementNode(t)){t=null}t=t||this;if(BX.type.isElementNode(t)){BX.defer((function(){t.disabled=true}))();var e=BX.findParent(t,BX.is_relative);t.bxwaiter=(e||document.body).appendChild(BX.create("DIV",{props:{className:"feed-com-loader"},style:{position:"absolute"}}));lastWaitElement=t;return t.bxwaiter}return true};var fcCloseWait=function(t){if(t&&!BX.type.isElementNode(t)){t=null}t=t||lastWaitElement||this;if(BX.type.isElementNode(t)){if(t.bxwaiter&&t.bxwaiter.parentNode){t.bxwaiter.parentNode.removeChild(t.bxwaiter);delete t.bxwaiter}t.disabled=false;if(lastWaitElement==t)lastWaitElement=null}};var fcShowActions=function(t,e,i){var n=[];var s=BX.util.getRandomString(20);if(i.getAttribute("bx-mpl-view-show")=="Y"){n.push({text:BX.message("MPL_MES_HREF"),href:i.getAttribute("bx-mpl-view-url").replace(/\\#(.+)$/gi,"")+"#com"+e,target:"_top"});n.push({html:'<span id="record-popup-'+s+'-link-text">'+BX.message("B_B_MS_LINK")+"</span>"+'<span id="record-popup-'+s+'-link-icon-animate" class="comment-menu-link-icon-wrap">'+'<span class="comment-menu-link-icon" id="record-popup-'+s+'-link-icon-done" style="display: none;">'+"</span>"+"</span>",onclick:function(){var t="record-popup-"+s+"-link",n=i.getAttribute("bx-mpl-view-url").replace(/#(.+)$/gi,"")+"#com"+e,o=BX(t+"-text"),a=BX(t+"-icon-done");n=(n.indexOf("http")<0?location.protocol+"//"+location.host:"")+n;if(BX.clipboard.isCopySupported()){if(o&&o.getAttribute("data-block-click")=="Y"){return}BX.clipboard.copy(n);if(o&&a){a.style.display="inline-block";BX.removeClass(BX(t+"-icon-animate"),"comment-menu-link-icon-animate");BX.adjust(BX(t+"-text"),{attrs:{"data-block-click":"Y"}});setTimeout((function(){BX.addClass(BX(t+"-icon-animate"),"comment-menu-link-icon-animate")}),1);setTimeout((function(){BX.adjust(BX(t+"-text"),{attrs:{"data-block-click":"N"}})}),500)}return}var r=BX.proxy_context;var d=parseInt(!!r.getAttribute("bx-height")?r.getAttribute("bx-height"):r.offsetHeight);if(r.getAttribute("bx-status")!="shown"){r.setAttribute("bx-status","shown");if(!BX(t)&&!!BX(t+"-text")){var l=BX(t+"-text"),h=BX.pos(l),m=BX.pos(l.parentNode),c=BX.findChildren(l.parentNode.parentNode.parentNode,{className:"menu-popup-item-text"},true);h["height"]=m["height"]-1;if(c){var u=0,p;for(var E=0;E<c.length;E++){p=BX.pos(c[E]);u=Math.max(u,p["width"])}m["width"]=u}BX.adjust(r,{attrs:{"bx-height":r.offsetHeight},style:{overflow:"hidden",display:"block"},children:[BX.create("BR"),BX.create("DIV",{attrs:{id:t},children:[BX.create("SPAN",{attrs:{className:"menu-popup-item-left"}}),BX.create("SPAN",{attrs:{className:"menu-popup-item-icon"}}),BX.create("SPAN",{attrs:{className:"menu-popup-item-text"},children:[BX.create("INPUT",{attrs:{id:t+"-input",type:"text",value:n},style:{height:m["height"]+"px",width:m["width"]+"px"},events:{click:function(t){this.select();t.preventDefault()}}})]})]}),BX.create("SPAN",{className:"menu-popup-item-right"})]})}new BX["fx"]({time:.2,step:.05,type:"linear",start:d,finish:d*2,callback:BX.delegate((function(t){this.style.height=t+"px"}),r)}).start();BX.fx.show(BX(t),.2);BX(t+"-input").select()}else{r.setAttribute("bx-status","hidden");new BX["fx"]({time:.2,step:.05,type:"linear",start:r.offsetHeight,finish:d,callback:BX.delegate((function(t){this.style.height=t+"px"}),r)}).start();BX.fx.hide(BX(t),.2)}}})}if(i.getAttribute("bx-mpl-edit-show")=="Y"){n.push({text:BX.message("BPC_MES_EDIT"),onclick:function(){BX.onCustomEvent(t,"onAct",[i.getAttribute("bx-mpl-edit-url"),e,"EDIT"]);this.popupWindow.close();return false}})}if(i.getAttribute("bx-mpl-moderate-show")=="Y"){var o=i.getAttribute("bx-mpl-moderate-approved")=="hidden";n.push({text:o?BX.message("BPC_MES_SHOW"):BX.message("BPC_MES_HIDE"),onclick:function(){var n=i.getAttribute("bx-mpl-moderate-url").replace("#action#",o?"show":"hide").replace("#ACTION#",o?"SHOW":"HIDE");if(BX.type.isNotEmptyString(n)){n=BX.util.add_url_param(n,{b24statAction:o?"showComment":"hideComment"})}BX.onCustomEvent(t,"onAct",[n,e,o?"SHOW":"HIDE"]);this.popupWindow.close()}})}if(i.getAttribute("bx-mpl-delete-show")=="Y"){n.push({text:BX.message("BPC_MES_DELETE"),onclick:function(){if(window.confirm(BX.message("BPC_MES_DELETE_POST_CONFIRM"))){BX.onCustomEvent(t,"onAct",[i.getAttribute("bx-mpl-delete-url"),e,"DELETE"])}this.popupWindow.close();return false}})}var a=i.getAttribute("bx-mpl-post-entity-xml-id");if(i.getAttribute("bx-mpl-edit-show")=="Y"&&BX.Tasks&&BX.Tasks.ResultAction&&a.indexOf("TASK_")===0&&BX.Tasks.ResultAction.getInstance().canCreateResult(+/\d+/.exec(a))){var r=+/\d+/.exec(a);var d=BX.Tasks.ResultManager.getInstance().getResult(r);if(d&&d.context==="task"&&d.canUnsetAsResult&&d.canUnsetAsResult(parseInt(e,10))){n.push({text:BX.message("BPC_MES_DELETE_TASK_RESULT"),onclick:function(){BX.Tasks.ResultAction.getInstance().deleteFromComment(e);this.popupWindow.close();return false}})}else if(d&&d.context==="task"&&d.canSetAsResult&&d.canSetAsResult(parseInt(e,10))){n.push({text:BX.message("BPC_MES_CREATE_TASK_RESULT"),onclick:function(){BX.Tasks.ResultAction.getInstance().createFromComment(e);this.popupWindow.close();return false}})}}if(i.getAttribute("bx-mpl-createtask-show")==="Y"&&!BX.type.isUndefined(BX.Livefeed)){var l=i.getAttribute("bx-mpl-comment-entity-type");var h=i.getAttribute("bx-mpl-post-entity-type");n.push({text:BX.message("BPC_MES_CREATE_TASK"),onclick:function(){BX.Livefeed.TaskCreator.create({postEntityType:BX.type.isNotEmptyString(h)?h:"BLOG_POST",entityType:BX.type.isNotEmptyString(l)?l:"BLOG_COMMENT",entityId:e});this.popupWindow.close();return false}})}if(i.getAttribute("bx-mpl-createsubtask-show")==="Y"&&!BX.type.isUndefined(BX.Livefeed)){var m=i.getAttribute("bx-mpl-post-entity-xml-id");var c=m.match(/^TASK_(\d+)$/i);if(c){n.push({text:BX.message("BPC_MES_CREATE_SUBTASK"),onclick:function(){BX.Livefeed.TaskCreator.create({postEntityType:h,entityType:l,entityId:e,parentTaskId:parseInt(c[1])});this.popupWindow.close();return false}})}}if(n.length>0){for(var u in n){if(n.hasOwnProperty(u)){n[u]["className"]="blog-comment-popup-menu"}}var p={offsetLeft:-18,offsetTop:2,lightShadow:false,angle:{position:"top",offset:50},events:{onPopupClose:function(){this.destroy();BX.PopupMenu.Data["action-"+s]=null}}};BX.onCustomEvent("OnUCCommentActionsShown",[t,e,n,p]);BX.PopupMenu.show("action-"+s,i,n,p)}};var fcCommentExpand=function(t){BX.UI.Animations.expand({moreButtonNode:t,type:"comment",classBlock:"feed-com-block",classOuter:"feed-com-text-inner",classInner:"feed-com-text-inner-inner",heightLimit:200,callback:function(t){BX.onCustomEvent(window,"OnUCRecordWasExpanded",[t]);t.classList.add("feed-com-text-inner-expanded");var e=t.getAttribute("bx-content-view-xml-id");if(BX.type.isNotEmptyString(e)){BX.onCustomEvent(window,"OnUCFeedChanged",[e.split("-")])}}})};window["fcParseTemplate"]=function(t,e,i){e=e||{};e["RIGHTS"]=e["RIGHTS"]||{};for(var n=0,s=["MODERATE","EDIT","DELETE"];n<s.length;n++){e["RIGHTS"][s[n]]=BX.util.in_array(e["RIGHTS"][s[n]],["Y","ALL","OWN","OWNLAST"])?e["RIGHTS"][s[n]]:"N"}e["DATE_TIME_FORMAT"]=!!e["DATE_TIME_FORMAT"]?e["DATE_TIME_FORMAT"]:"d F Y G:i";e["TIME_FORMAT"]=!!e["DATE_TIME_FORMAT"]&&e["DATE_TIME_FORMAT"].indexOf("a")>=0?"g:i a":"G:i";e["VIEW_URL"]=e["VIEW_URL"]||"";e["EDIT_URL"]=e["EDIT_URL"]||"";e["MODERATE_URL"]=e["MODERATE_URL"]||"";e["DELETE_URL"]=e["DELETE_URL"]||"";e["AUTHOR_URL"]=e["AUTHOR_URL"]||"";e["NAME_TEMPLATE"]=e["NAME_TEMPLATE"]||"";e["SHOW_LOGIN"]=e["SHOW_LOGIN"]||"";var o=t&&t["messageFields"]?t["messageFields"]:t;var a={ID:"",FULL_ID:"",CONTENT_ID:"",ENTITY_XML_ID:"",EXEMPLAR_ID:"",NEW:"old",APPROVED:"Y",DATE:"",TEXT:"",CLASSNAME:"",VIEW_URL:"",VIEW_SHOW:"N",EDIT_URL:"",EDIT_SHOW:"N",MODERATE_URL:"",MODERATE_SHOW:"N",DELETE_URL:"",DELETE_SHOW:"N",CREATETASK_SHOW:"N",BEFORE_HEADER:"",BEFORE_ACTIONS:"",AFTER_ACTIONS:"",AFTER_HEADER:"",BEFORE:"",AFTER:"",BEFORE_RECORD:"",AFTER_RECORD:"",AUTHOR_ID:0,AUTHOR_AVATAR_IS:"N",AUTHOR_AVATAR:"",AUTHOR_URL:"",AUTHOR_NAME:"",AUTHOR_EXTRANET_STYLE:"",SHOW_POST_FORM:"Y",SHOW_MENU:"Y",VOTE_ID:"",AUTHOR_TOOLTIP_PARAMS:"","background:url('') no-repeat center;":"",LIKE_REACT:"",RATING_NONEMPTY_CLASS:""};if(!!o&&!!t["messageFields"]){o["AUTHOR"]=!!o["AUTHOR"]?o["AUTHOR"]:{};var r=parseInt(o["POST_TIMESTAMP"])+parseInt(BX.message("USER_TZ_OFFSET"))+parseInt(BX.message("SERVER_TZ_OFFSET"));var d=[["today",e["TIME_FORMAT"]],["yesterday",e["TIME_FORMAT"].indexOf("yesterday")<0?"yesterday, "+e["TIME_FORMAT"]:e["TIME_FORMAT"]],["",e["DATE_TIME_FORMAT"]]];var l="";if(!BX.Type.isUndefined(o["AUTHOR"]["TYPE"])){if(o["AUTHOR"]["TYPE"]==="EMAIL"){l=" feed-com-name-email"}else if(o["AUTHOR"]["TYPE"]==="EXTRANET"){l=" feed-com-name-extranet"}}else if(o["AUTHOR"]["IS_EXTRANET"]=="Y"){l=" feed-com-name-extranet"}var h=o["POST_MESSAGE_TEXT"].replace(/\001/gi,"").replace(/#/gi,"\x01");o.AUX_LIVE_PARAMS=BX.type.isPlainObject(o.AUX_LIVE_PARAMS)?o.AUX_LIVE_PARAMS:{};if(!!o.AUX&&(BX.util.in_array(o.AUX,["createentity","createtask","fileversion"])||o.AUX==="TASKINFO"&&BX.type.isNotEmptyObject(o.AUX_LIVE_PARAMS))){h=BX.CommentAux.getLiveText(o.AUX,o.AUX_LIVE_PARAMS)}a={ID:o["ID"],FULL_ID:o["FULL_ID"].join("-"),CONTENT_ID:o["RATING"]&&o["RATING"]["ENTITY_TYPE_ID"]&&o["RATING"]["ENTITY_ID"]?o["RATING"]["ENTITY_TYPE_ID"]+"-"+o["RATING"]["ENTITY_ID"]:"",ENTITY_XML_ID:o["ENTITY_XML_ID"],EXEMPLAR_ID:e["EXEMPLAR_ID"],NEW:o["NEW"]=="Y"?"new":"old",APPROVED:o["APPROVED"]!="Y"?"hidden":"approved",DATE:BX.date.format(d,r,parseInt(Date.now()/1e3)+parseInt(BX.message("USER_TZ_OFFSET"))+parseInt(BX.message("SERVER_TZ_OFFSET")),true),TEXT:h,CLASSNAME:(o["CLASSNAME"]?" "+o["CLASSNAME"]:"")+(BX.type.isNotEmptyString(e["CLASSNAME"])?" "+e["CLASSNAME"]:""),VIEW_URL:e["VIEW_URL"].replace("#ID#",o["ID"]).replace("#id#",o["ID"]),VIEW_SHOW:e["VIEW_URL"]!==""?"Y":"N",EDIT_URL:e["EDIT_URL"].replace("#ID#",o["ID"]).replace("#id#",o["ID"]),EDIT_SHOW:(!o.AUX||o.AUX.length<=0)&&(e["RIGHTS"]["EDIT"]=="Y"||e["RIGHTS"]["EDIT"]=="ALL"||e["RIGHTS"]["EDIT"]=="OWN"&&BX.message("USER_ID")==o["AUTHOR"]["ID"])?"Y":"N",MODERATE_URL:e["MODERATE_URL"].replace("#ID#",o["ID"]).replace("#id#",o["ID"]),MODERATE_SHOW:e["RIGHTS"]["MODERATE"]=="Y"||e["RIGHTS"]["MODERATE"]=="ALL"||e["RIGHTS"]["MODERATE"]=="OWN"&&BX.message("USER_ID")==o["AUTHOR"]["ID"]?"Y":"N",DELETE_URL:e["DELETE_URL"].replace("#ID#",o["ID"]).replace("#id#",o["ID"]),DELETE_SHOW:(!o["CAN_DELETE"]||o["CAN_DELETE"]==="Y")&&(e["RIGHTS"]["DELETE"]=="Y"||e["RIGHTS"]["DELETE"]=="ALL"||e["RIGHTS"]["DELETE"]=="OWN"&&BX.message("USER_ID")==o["AUTHOR"]["ID"]?"Y":"N"),CREATETASK_SHOW:(!o.AUX||o.AUX.length<=0)&&e["RIGHTS"]["CREATETASK"]=="Y"?"Y":"N",CREATESUBTASK_SHOW:(!o.AUX||o.AUX.length<=0)&&BX.type.isNotEmptyString(e.RIGHTS.CREATESUBTASK)&&e.RIGHTS.CREATESUBTASK==="Y"?"Y":"N",BEFORE_HEADER:o["BEFORE_HEADER"],BEFORE_ACTIONS:o["BEFORE_ACTIONS"],AFTER_ACTIONS:o["AFTER_ACTIONS"],AFTER_HEADER:o["AFTER_HEADER"],BEFORE:o["BEFORE"],AFTER:o["AFTER"],BEFORE_RECORD:o["BEFORE_RECORD"],AFTER_RECORD:o["AFTER_RECORD"],AUTHOR_ID:o["AUTHOR"]["ID"],AUTHOR_AVATAR_IS:!!o["AUTHOR"]["AVATAR"]?"Y":"N",AUTHOR_AVATAR:!!o["AUTHOR"]["AVATAR"]?o["AUTHOR"]["AVATAR"]:"/bitrix/images/1.gif",AUTHOR_AVATAR_BG:!!o["AUTHOR"]["AVATAR"]?"background-image:url('"+o["AUTHOR"]["AVATAR"]+"')":"",AUTHOR_URL:e["AUTHOR_URL"].replace("#ID#",o["ID"]).replace("#id#",o["ID"]).replace("#USER_ID#",o["AUTHOR"]["ID"]).replace("#user_id#",o["AUTHOR"]["ID"])+(!BX.Type.isUndefined(o["AUTHOR"]["EXTERNAL_AUTH_ID"])&&o["AUTHOR"]["EXTERNAL_AUTH_ID"]==="email"&&!BX.Type.isUndefined(e["AUTHOR_URL_PARAMS"])?(e["AUTHOR_URL"].indexOf("?")>=0?"&":"?")+"entityType="+e["AUTHOR_URL_PARAMS"]["entityType"]+"&entityId="+e["AUTHOR_URL_PARAMS"]["entityId"]:""),AUTHOR_NAME:BX.formatName(o["AUTHOR"],e["NAME_TEMPLATE"],e["SHOW_LOGIN"]),AUTHOR_EXTRANET_STYLE:l,VOTE_ID:o["RATING"]&&o["RATING"]["VOTE_ID"]?o["RATING"]["VOTE_ID"]:"",AUTHOR_PERSONAL_GENDER:BX.type.isNotEmptyString(o["AUTHOR"]["PERSONAL_GENDER"])?o["AUTHOR"]["PERSONAL_GENDER"]:"",AUTHOR_TOOLTIP_PARAMS:!BX.Type.isUndefined(o["AUTHOR_TOOLTIP_PARAMS"])?o["AUTHOR_TOOLTIP_PARAMS"]:"{}","background:url('') no-repeat center;":"",LIKE_REACT:!!o["LIKE_REACT"]?o["LIKE_REACT"]:"",RATING_NONEMPTY_CLASS:o["RATING"]&&o["RATING"]["TOTAL_VOTES"]?"comment-block-rating-nonempty":"",POST_ENTITY_TYPE:!!e["POST_CONTENT_TYPE_ID"]?e["POST_CONTENT_TYPE_ID"]:"",COMMENT_ENTITY_TYPE:!!e["COMMENT_CONTENT_TYPE_ID"]?e["COMMENT_CONTENT_TYPE_ID"]:""}}else{for(n in a){if(a.hasOwnProperty(n)){a[n]=!!t[n]?t[n]:a[n]}}}for(n in a){if(a.hasOwnProperty(n)){a[n]=!!a[n]?a[n]:""}}a["SHOW_POST_FORM"]=BX("record-"+a["ENTITY_XML_ID"]+"-0-placeholder")?"Y":"N";for(var m in a){if(a.hasOwnProperty(m)){i=i.replace(new RegExp("#"+m+"#","g"),function(){return a[this]}.bind(m))}}return i.replace("background:url('') no-repeat center;","").replace(/\001/gi,"#")};window["fcPull"]=function(t,e){BX.ajax({url:"/bitrix/components/bitrix/main.post.list/templates/.default/component_epilog.php",method:"POST",data:{AJAX_POST:"Y",ENTITY_XML_ID:t,MODE:"PUSH&PULL",sessid:BX.bitrix_sessid(),DATA:e}})};var MPLQuote=function(){this.closeByEsc=true;this.autoHide=true;this.autoHideTimeout=5e3;this.node=document.createElement("A");BX.adjust(this.node,{style:{zIndex:BX.PopupWindow.getOption("popupZindex")+1,position:"absolute",display:"none",top:"0px",left:"0px"},attrs:{className:"mpl-quote-block",href:"#"},events:{click:this.fire.bind(this)}});this.checkEsc=this.checkEsc.bind(this);this.hide=this.hide.bind(this);document.body.appendChild(this.node)};MPLQuote.prototype={show:function(t){var e=this.getPosition(this.node,t);BX.adjust(this.node,{style:{top:e.y+"px",left:e.x+"px",display:"block"}});BX.addClass(this.node,"mpl-quote-block-show");if(this.closeByEsc&&this.closeByEscBound!==true){this.closeByEscBound=true;BX.bind(document,"keyup",this.checkEsc)}if(this.autoHide&&this.autoHideBound!==true){this.autoHideBound=true;setTimeout(function(){BX.bind(document,"click",this.hide)}.bind(this),10)}if(this.autoHideTimeoutPointer>0){clearTimeout(this.autoHideTimeoutPointer);this.autoHideTimeoutPointer=0}if(this.autoHideTimeout>0&&this.autoHideTimeoutBound!==true){this.autoHideTimeoutBound=true;this.autoHideTimeoutPointer=setTimeout(this.hide,this.autoHideTimeout)}},fire:function(t){t.preventDefault();if(!this.isShown()){return}if(t&&!(BX.getEventButton(t)&BX.MSLEFT)){return}this.cancelBubble(t);this.node.style.display="none";BX.onCustomEvent(this,"onQuote",[t,this]);setTimeout(this.hide,50);return false},hide:function(){BX.unbind(document,"keyup",this.checkEsc);this.closeByEscBound=false;BX.unbind(document,"click",this.hide);this.autoHideBound=false;if(this.autoHideTimeoutPointer>0){clearTimeout(this.autoHideTimeoutPointer)}this.autoHideTimeoutPointer=0;this.autoHideTimeoutBound=false;BX.onCustomEvent(this,"onHide",[this]);BX.remove(this.node)},getPosition:function(t,e){var i;if(e.pageX==null){var n=document.documentElement,s=document.body;var o=e.clientX+(n&&n.scrollLeft||s&&s.scrollLeft||0)-(n.clientLeft||0);var a=e.clientY+(n&&n.scrollTop||s&&s.scrollTop||0)-(n.clientTop||0);i={x:o,y:a}}else{i={x:e.pageX,y:e.pageY}}return{x:i.x+5,y:i.y-16}},isShown:function(){return this.node.style.display==="block"},cancelBubble:function(t){if(!t){t=window.event}if(t.stopPropagation){t.stopPropagation()}else{t.cancelBubble=true}},checkEsc:function(t){t=t||window.event;if(t.keyCode==27){this.hide(t)}}};var checkEntitiesActuality=function(t){var e=repo.listById.values();var i=e.next();while(i.done!==true){if(i.value.getXmlId()===t&&!document.body.contains(i.value.node.main)){BX.onCustomEvent(window,"OnUCInitialized",[i.value.getId()])}i=e.next()}};var getActiveEntitiesByXmlId=function(t){checkEntitiesActuality(t);var e=repo.listById.values();var i=e.next();var n=new Map;while(i.done!==true){if(i.value.getXmlId()===t){n.set(i.value.getId(),i.value)}i=e.next()}return n};window.mplCheckForQuote=function(t,e,i,n){t=document.all?window.event:t;var s="",o,a=null;if(window.getSelection){o=window.getSelection();s=o.toString()}else if(document.selection){o=document.selection;s=o.createRange().text}if(s.length<=0){return}var r=BX.findParent(o.focusNode,{tagName:e.tagName,className:e.className},e),d=BX.findParent(o.anchorNode,{tagName:e.tagName,className:e.className},e);if(r!==d||r!==e){return}var l=getActiveEntitiesByXmlId(i);if(l.size<=0){return}if(n&&BX(n,true)){var h=BX(n,true);if(h&&h.hasAttribute("bx-post-author-id")){a={id:parseInt(h.getAttribute("bx-post-author-id")),gender:h.getAttribute("bx-post-author-gender"),name:h.innerHTML}}}var m=null;if(e.__boundXmlCheckQuote===true){m=repo.listById.get(e.__boundXmlEntityId)||null}if(m===null){e.__boundXmlCheckQuote=true;var c=e;while(c){l.forEach((function(t,e){if(m===null&&c.contains(t.node.main)){m=t;return true}}));if(m!==null){break}c=c.parentNode}if(m===null){m=l.values().next().value}e.__boundXmlEntityId=m.getId();BX.addCustomEvent(window,"OnUCHasBeenDestroyed",(function(t,i){if(i.getId()===e.__boundXmlEntityId){delete e.__boundXmlEntityId;delete e.__boundXmlCheckQuote}}))}if(m!==null){BX.onCustomEvent(m.eventNode,"onQuote",[t,{text:s,author:a}])}};window.mplReplaceUserPath=function(t){if(!BX.Type.isStringFilled(t)){return""}if(BX("MPL_IS_EXTRANET_SITE")==="Y"){t=t.replace("/company/personal/user/","/extranet/contacts/personal/user/")}else{t=t.replace("/extranet/contacts/personal/user/","/company/personal/user/")}t=t.replace(new RegExp("[\\w/]*/mobile/users/\\?user_id=(\\d+)","igm"),BX("MPL_IS_EXTRANET_SITE")=="Y"?"/extranet/contacts/personal/user/$1/":"/company/personal/user/$1/");return t};BX.addCustomEvent(window,"BX.Livefeed:recalculateComments",(function(t){if(!BX.type.isPlainObject(t)||!BX.type.isDomNode(t.rootNode)){return}var e=t.rootNode.querySelectorAll(".feed-comments-block");var i=null;for(var n=0;n<e.length;n++){i=e[n].getAttribute("data-bx-comments-entity-xml-id");if(BX.type.isNotEmptyString(i)){BX.onCustomEvent(window,"OnUCCommentRecalculate",[i])}}}));BX.addCustomEvent(window,"BX.Forum.Spoiler:toggle",(function(t){if(!t.node){return}var e=BX.findParent(t.node,{attrs:{"bx-mpl-block":"main"}});if(e){BX.onCustomEvent(e,"onForumSpoilerToggle",[e.getAttribute("bx-mpl-entity-id")])}}));var ScreenSpy=function(){this.timeoutSec=2e3;this.check=this.check.bind(this);this.change=this.change.bind(this);this.scroll=this.scroll.bind(this);this.nodes=new Map;this.timeout=0;this.ready=true;this.window=BX.GetWindowInnerSize();this.screen={top:this.window.scrollTop,bottom:this.window.scrollTop+this.window.innerHeight};this.watchDimensionNodes=new WeakMap};ScreenSpy.prototype={watchNode:function(t){if(!this.watchDimensionNodes.has(t)){this.watchDimensionNodes.set(t,false);BX.bind(t,"click",this.check)}},set:function(t,e){this.nodes.set(t,e);this.start()},unset:function(t){this.nodes.delete(t);if(this.nodes.size<=0){this.stop()}},start:function(){if(this.ready!==true){return}this.ready=false;BX.bind(window,"resize",this.change);BX.bind(window,"scroll",this.scroll);this.scroll()},stop:function(){if(this.timeout>0){clearTimeout(this.timeout)}this.timeout=0;BX.unbind(window,"resize",this.change);BX.unbind(window,"scroll",this.scroll);this.ready=true},check:function(){this.timeout=0;var t=BX.GetWindowScrollPos();if(this.screen.bottom>t.scrollTop){var e={top:t.scrollTop,bottom:this.screen.bottom};BX.onCustomEvent(this,"onRead",[e])}if(this.screen.top!==t.scrollTop){this.scroll()}},change:function(){this.window=BX.GetWindowInnerSize()},scroll:function(){if(this.timeout<=0){var t=BX.GetWindowScrollPos();this.screen={top:t.scrollTop,bottom:t.scrollTop+this.window.innerHeight};this.timeout=setTimeout(this.check,this.timeoutSec)}}};var scrSpy=new ScreenSpy;BX.ready((function(){BX.addCustomEvent(window,"onPullEvent-unicomments",(function(t,e){if(e["AUX"]&&!BX.util.in_array(e["AUX"].toLowerCase(),BX.CommentAux.getLiveTypesList())||getActiveEntitiesByXmlId(e["ENTITY_XML_ID"]).size<=0){return}if(t==="comment"){if(e["NEED_REQUEST"]==="Y"){if(e["URL"]["LINK"].indexOf("#GROUPS_PATH#")>=0&&!!BX.message("MPL_WORKGROUPS_PATH")){e["URL"]["LINK"]=e["URL"]["LINK"].replace("#GROUPS_PATH#",BX.message("MPL_WORKGROUPS_PATH"))}var i=BX.ajax.prepareData({AJAX_POST:"Y",ENTITY_XML_ID:e["ENTITY_XML_ID"],MODE:"RECORD",FILTER:{ID:e["ID"]},sessid:BX.bitrix_sessid()});var n=e["URL"]["LINK"];n=n.indexOf("#")!==-1?n.substr(0,n.indexOf("#")):n;BX.ajax({url:n+(n.indexOf("?")!==-1?"&":"?")+i,method:"GET",dataType:"json",data:"",onsuccess:function(t){BX.onCustomEvent(window,"OnUCCommentWasPulled",[[e["ENTITY_XML_ID"],e["ID"]],t,e])}})}else if(e["ACTION"]==="DELETE"){BX.onCustomEvent(window,"OnUCommentWasDeleted",[e["ENTITY_XML_ID"],[e["ENTITY_XML_ID"],e["ID"]],e]);BX.onCustomEvent(window,"OnUCFeedChanged",[e["ID"]])}else if(e["ACTION"]==="HIDE"){BX.onCustomEvent(window,"OnUCommentWasHidden",[e["ENTITY_XML_ID"],[e["ENTITY_XML_ID"],e["ID"]],e]);BX.onCustomEvent(window,"OnUCFeedChanged",[e["ID"]])}else{if(e["ACTION"]==="REPLY"){e["NEW"]=!e["AUTHOR"]||e["AUTHOR"]["ID"]!=BX.message("USER_ID")?"Y":"N"}BX.onCustomEvent(window,"OnUCCommentWasPulled",[[e["ENTITY_XML_ID"],e["ID"]],{messageFields:e},e])}}else if(t==="answer"&&Number(e["USER_ID"])!==Number(BX.message("USER_ID"))){BX.onCustomEvent(window,"OnUCUsersAreWriting",[e["ENTITY_XML_ID"],e["USER_ID"],e["NAME"],e["AVATAR"]])}}));BX.addCustomEvent(window,"OnUCUserReply",(function(t,e,i){var n=getActiveEntitiesByXmlId(t);if(n.size<=0){return}n.values().next().value.reply({id:e,name:i})}))}));BX.onCustomEvent("main.post.list/default",[])})();
//# sourceMappingURL=script.map.js